<template>
  <header>
    
    <div class="nav">
        <el-menu
          :default-active="activeIndex2"
          class="el-menu-demo"
          mode="horizontal"
          @select="handleSelect"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b">
          <el-menu-item index="1">处理中心</el-menu-item>
          <el-submenu index="2">
            <template slot="title">我的工作台</template>
            <el-menu-item index="2-1">选项1</el-menu-item>
            <el-menu-item index="2-2">选项2</el-menu-item>
            <el-menu-item index="2-3">选项3</el-menu-item>
            <el-submenu index="2-4">
              <template slot="title">选项4</template>
              <el-menu-item index="2-4-1">选项1</el-menu-item>
              <el-menu-item index="2-4-2">选项2</el-menu-item>
              <el-menu-item index="2-4-3">选项3</el-menu-item>
            </el-submenu>
          </el-submenu>
          <el-menu-item index="3" disabled>消息中心</el-menu-item>
          <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">订单管理</a></el-menu-item>
        </el-menu>
    </div>
    <!-- 设置导航栏右边头像 -->
    <div class="r-content">
      <el-dropdown trigger="click">
        <span class="el-dropdown-link"><img :src="userImg" class="user"/><i class="el-icon-arrow-down el-icon--right"></i></span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item icon="el-icon-plus"><router-link to="">个人中心</router-link></el-dropdown-item>
          <el-dropdown-item icon="el-icon-circle-plus"><router-link to="/login">退出登录</router-link></el-dropdown-item>
          <el-dropdown-item icon="el-icon-circle-plus-outline">螺蛳粉</el-dropdown-item>
          <el-dropdown-item icon="el-icon-check">双皮奶</el-dropdown-item>
          <el-dropdown-item icon="el-icon-circle-check">蚵仔煎</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
    <!-- <div class="logout">
        <li>
            <router-link to="/" title="个人中心">
            <span class="">个人中心</span>
            </router-link>
        </li>
        <li>
            <router-link to="/login" title="退出登录" class="ml5">
            <span class="">退出</span>
            </router-link>
        </li> 
    </div> -->
  </header>
</template>

<script>
// 导入vuex状态管理模块
import { mapState } from 'vuex'
export default {
  computed: {
    // 获取store下tab.js文件selectMenu方法中currentMenu对象数据
    ...mapState({
      current: state => state.tab.currentMenu
    })
  },
  data() {
    return {
      userImg: require('../assets/images/violet.png'),
      activeIndex: '1',
      activeIndex2: '1'
    }
  },
  methods:{
      handleSelect(key, keyPath) {
        console.log(key, keyPath);
      }
    }
}
</script>

<style scoped>

header {
  float: flex;
  align-items: center;
  height: 100%;
  justify-content: space-between;
}

.l-content {
  float: left;
  align-items: center;
  }
.l-content,.el-button {
    margin-right: 20px;

}
.nav{
  float: left;
}
.r-content{
  float: left;
}
.r-content,
.user {

    width: 40px;
    height: 40px;
    border-radius: 50%;
}
.el-breadcrumb-item,.el-breadcrumb_inner{
    color: #fff;
  }

/* :last-child,
  .el-breadcrumb__inner {
      color: #f4f4f4;
} */
.logout{
    list-style: none;
    width: 100px;
}
.logout li{
    float: left;
}
.el-dropdown-item{
  color:#333
}
</style>


